<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/activeqt/control/qaxbindable.cpp -->
<head>
  <title>Qt 4.3: QAxBindable Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QAxBindable Class Reference<br /><sup><sup>[<a href="qaxserver.html">QAxServer</a> module]</sup></sup></h1>
<p>The QAxBindable class provides an interface between a <a href="qwidget.html">QWidget</a> and an ActiveX client. <a href="#details">More...</a></p>
<pre> #include &lt;QAxBindable&gt;</pre><ul>
<li><a href="qaxbindable-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qaxbindable.html#QAxBindable">QAxBindable</a></b> ()</li>
<li><div class="fn"/>virtual <b><a href="qaxbindable.html#dtor.QAxBindable">~QAxBindable</a></b> ()</li>
<li><div class="fn"/>virtual QAxAggregated * <b><a href="qaxbindable.html#createAggregate">createAggregate</a></b> ()</li>
<li><div class="fn"/>virtual bool <b><a href="qaxbindable.html#readData">readData</a></b> ( QIODevice * <i>source</i>, const QString &amp; <i>format</i> )</li>
<li><div class="fn"/>void <b><a href="qaxbindable.html#reportError">reportError</a></b> ( int <i>code</i>, const QString &amp; <i>src</i>, const QString &amp; <i>desc</i>, const QString &amp; <i>context</i> = QString() )</li>
<li><div class="fn"/>virtual bool <b><a href="qaxbindable.html#writeData">writeData</a></b> ( QIODevice * <i>sink</i> )</li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>IUnknown * <b><a href="qaxbindable.html#clientSite">clientSite</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qaxbindable.html#propertyChanged">propertyChanged</a></b> ( const char * <i>property</i> )</li>
<li><div class="fn"/>bool <b><a href="qaxbindable.html#requestPropertyChange">requestPropertyChange</a></b> ( const char * <i>property</i> )</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QAxBindable class provides an interface between a <a href="qwidget.html">QWidget</a> and an ActiveX client.</p>
<p>The functions provided by this class allow an ActiveX control to communicate property changes to a client application. Inherit your control class from both <a href="qwidget.html">QWidget</a> (directly or indirectly) and this class to get access to this class's functions. The <a href="moc.html#moc">meta-object compiler</a> requires you to inherit from <a href="qwidget.html">QWidget</a> first.</p>
<pre> class MyActiveX : public QWidget, public QAxBindable
 {
     Q_OBJECT
     Q_PROPERTY(int value READ value WRITE setValue)

 public:
     MyActiveX(QWidget *parent = 0);
     ...

     int value() const;
     void setValue(int);
 };</pre>
<p>When implementing the property write function, use <a href="qaxbindable.html#requestPropertyChange">requestPropertyChange</a>() to get permission from the ActiveX client application to change this property. When the property changes, call <a href="qaxbindable.html#propertyChanged">propertyChanged</a>() to notify the ActiveX client application about the change. If a fatal error occurs in the control, use the static <a href="qaxbindable.html#reportError">reportError</a>() function to notify the client.</p>
<p>Use the interface returned by <a href="qaxbindable.html#clientSite">clientSite</a>() to call the ActiveX client. To implement additional COM interfaces in your ActiveX control, reimplement <a href="qaxbindable.html#createAggregate">createAggregate</a>() to return a new object of a <a href="qaxaggregated.html">QAxAggregated</a> subclass.</p>
<p>The <a href="activeqt.html#activeqt">ActiveQt</a> <a href="activeqt-opengl.html">OpenGL</a> example shows how to use QAxBindable to implement additional COM interfaces.</p>
<p>See also <a href="qaxaggregated.html">QAxAggregated</a>, <a href="qaxfactory.html">QAxFactory</a>, and <a href="activeqt.html">ActiveQt Framework</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QAxBindable"></a>QAxBindable::QAxBindable ()</h3>
<p>Constructs an empty <a href="qaxbindable.html">QAxBindable</a> object.</p>
<h3 class="fn"><a name="dtor.QAxBindable"></a>QAxBindable::~QAxBindable ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destroys the <a href="qaxbindable.html">QAxBindable</a> object.</p>
<h3 class="fn"><a name="clientSite"></a>IUnknown * QAxBindable::clientSite () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns a pointer to the client site interface for this ActiveX object, or null if no client site has been set.</p>
<p>Call <tt>QueryInterface()</tt> on the returned interface to get the interface you want to call.</p>
<h3 class="fn"><a name="createAggregate"></a><a href="qaxaggregated.html">QAxAggregated</a> * QAxBindable::createAggregate ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Reimplement this function when you want to implement additional COM interfaces in the ActiveX control, or when you want to provide alternative implementations of COM interfaces. Return a new object of a <a href="qaxaggregated.html">QAxAggregated</a> subclass.</p>
<p>The default implementation returns the null pointer.</p>
<h3 class="fn"><a name="propertyChanged"></a>void QAxBindable::propertyChanged ( const char * <i>property</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Call this function to notify the client that is hosting this ActiveX control that the property <i>property</i> has been changed.</p>
<p>This function is usually called at the end of the property's write function.</p>
<p>See also <a href="qaxbindable.html#requestPropertyChange">requestPropertyChange</a>().</p>
<h3 class="fn"><a name="readData"></a>bool QAxBindable::readData ( <a href="qiodevice.html">QIODevice</a> * <i>source</i>, const <a href="qstring.html">QString</a> &amp; <i>format</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>If the COM object supports a MIME type then this function is called to initialize the COM object from the data <i>source</i> in <i>format</i>. You have to open <i>source</i> for reading before you can read from it.</p>
<p>Returns true to indicate success. If the function returns false, then <a href="activeqt.html#activeqt">ActiveQt</a> will process the data by setting the properties through the meta object system.</p>
<p>If you reimplement this function you also have to implement <a href="qaxbindable.html#writeData">writeData</a>(). The default implementation does nothing and returns false.</p>
<p><b>Warning:</b> ActiveX controls embedded in HTML can use either the <tt>type</tt> and <tt>data</tt> attribute of the <tt>object</tt> tag to read data, or use a list of <tt>param</tt> tags to initialize properties. If <tt>param</tt> tags are used, then Internet Explorer will ignore the <tt>data</tt> attribute, and readData will not be called.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qaxbindable.html#writeData">writeData</a>().</p>
<h3 class="fn"><a name="reportError"></a>void QAxBindable::reportError ( int <i>code</i>, const <a href="qstring.html">QString</a> &amp; <i>src</i>, const <a href="qstring.html">QString</a> &amp; <i>desc</i>, const <a href="qstring.html">QString</a> &amp; <i>context</i> = QString() )</h3>
<p>Reports an error to the client application. <i>code</i> is a control-defined error code. <i>desc</i> is a human-readable description of the error intended for the application user. <i>src</i> is the name of the source for the error, typically the ActiveX server name. <i>context</i> can be the location of a help file with more information about the error. If <i>context</i> ends with a number in brackets, e.g&#x2e; [12], this number will be interpreted as the context ID in the help file.</p>
<h3 class="fn"><a name="requestPropertyChange"></a>bool QAxBindable::requestPropertyChange ( const char * <i>property</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Call this function to request permission to change the property <i>property</i> from the client that is hosting this ActiveX control. Returns true if the client allows the change; otherwise returns false.</p>
<p>This function is usually called first in the write function for <i>property</i>, and writing is abandoned if the function returns false.</p>
<pre> void MyActiveQt::setText(const QString &amp;text)
 {
     if (!requestPropertyChange(&quot;text&quot;))
         return;

     <span class="comment">//</span> update property

     propertyChanged(&quot;text&quot;);
 }</pre>
<p>See also <a href="qaxbindable.html#propertyChanged">propertyChanged</a>().</p>
<h3 class="fn"><a name="writeData"></a>bool QAxBindable::writeData ( <a href="qiodevice.html">QIODevice</a> * <i>sink</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>If the COM object supports a MIME type then this function is called to store the COM object into <i>sink</i>. You have to open <i>sink</i> for writing before you can write to it.</p>
<p>Returns true to indicate success. If the function returns false, then <a href="activeqt.html#activeqt">ActiveQt</a> will serialize the object by storing the property values.</p>
<p>If you reimplement this function you also have to implement <a href="qaxbindable.html#readData">readData</a>(). The default implementation does nothing and returns false.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qaxbindable.html#readData">readData</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
